package stream;

import java.util.Arrays;
import java.util.List;

/**
 * @author feng
 * @Date 2022/2/24 20:34
 * 找出2011年的交易额，并按从小到大的顺序进行排序
 * 1.筛选、切片、映射、排序、最大最小、
 */
public class Test {
    public static void main(String[] args) {
        Trader raoul = new Trader("Raoul", "Cambridge");

        Trader mario = new Trader("Mario", "Milan");

        Trader alan = new Trader("Alan", "Cambridge");

        Trader brian = new Trader("Brian", "Cambridge");

        List<Transaction> transactions = Arrays.asList(

                new Transaction("brian", 2011, 300.0),

                new Transaction("raoul", 2012, 1000.0),

                new Transaction("raoul", 2011, 400.0),

                new Transaction("mario", 2012, 710.0),

                new Transaction("mario", 2012, 700.0),

                new Transaction("alan", 2012, 950.0)
        );

        transactions.stream().filter((e) -> e.getYear() == 2011).sorted((e1, e2) -> e1.getSalary().compareTo(e2.getSalary()))
                .forEach(System.out::println);

    }

}
